package com.example.intef;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 有时希望项目在启动的时候加载一些系统参数或者方法，就要用到ApplicationRunner
 * ApplicationRunner是一个接口，我们需要实现它，并重写run()方法，当项目启动时，run()方法便会自动执行
 */
@Component
@Order(value = 1)
public class ApplicationRunnerDoing implements ApplicationRunner {

    private static final Logger logger = LoggerFactory.getLogger(ApplicationRunnerDoing.class);

    @Override
    public void run(ApplicationArguments args) throws Exception {
        logger.info("====== ApplicationRunner Test ======");
    }
}
